package leetcode.code1647;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int minDeletions(String s) {
		char[] cs = s.toCharArray();
		int[] dics = new int[26];
		for (int i = 0; i < cs.length; i++) {
			dics[cs[i] - 'a']++;
		}
		int ans = 0;
		Set<Integer> set = new HashSet<>();
		for (int i = 0; i < dics.length; i++) {
			int cur = dics[i];
			while (cur != 0 && !set.add(cur)) {
				cur--;
				ans++;
			}
		}
		return ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
